package com.db.stexchem.server;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.db.stexchem.message.Order;

public class OrderBook {
  
  private final Map<String, OpenBook> openBooks = new HashMap<>();
  
  public OrderBook(Set<String> stocks) {
    for (String stock : stocks) {
      openBooks.put(stock, new OpenBook());
    }
  }
  
  public List<Match> add(Order order) {
    String stock = order.getStockName();

    return openBooks.get(stock).add(order);
  }
  
}
